package com.jiantong.work.util;

import com.jiantong.user.ext.LoginUser;
import com.jiantong.work.enums.AuthorityType;

import java.util.Map;

/**
 * Created by niufei on 2017/5/3.
 *
 */
public class HasAuthorityUtils {

    public static Integer hasAuthority(LoginUser loginUser){
        Integer organizationType = loginUser.getOrganizationType();
        if(organizationType != 3) return AuthorityType.NON.value();
        Map<String , Object> roleMap = loginUser.getRoles();
        Integer departmentType = loginUser.getDepartmentType();
        int code;
        if(roleMap == null || roleMap.isEmpty()) return AuthorityType.NON.value();
        else code = (int) roleMap.get("code");
        return 1;
    }
}
